package extras.mak001;

public class Time {
	private long startTime = 0;
	private long millisAtPause = 0;
	private boolean isPaused = false;

	public Time() {
		startTime = System.currentTimeMillis();
	}

	public long currTime() {
		if (!isPaused)
			return System.currentTimeMillis() - startTime;
		else
			return millisAtPause;
	}

	public void pause() {
		millisAtPause = System.currentTimeMillis() - startTime;
		isPaused = true;
	}

	public void resume() {
		startTime = System.currentTimeMillis() - millisAtPause;
		isPaused = false;
	}

	public boolean isPaused() {
		return isPaused;
	}

	public void reset() {
		startTime = System.currentTimeMillis();
		isPaused = false;
		millisAtPause = 0;
	}

}
